package com.itlong.cloud.enumerate;

import java.util.Objects;

/**
 * <desc>
 *      App用户小区类型枚举
 * </desc>
 *
 * @createDate 2017/10/13
 */
public enum AppUserProjectTypeEnum {
    USERPROJECT_TYPE_SELF("自己居住", 0),
    USERPROJECT_TYPE_ARROUND("周边小区", 1),
    ;
    private String description;
    private Integer type;

    /**
     * <desc>
     *      App用户项目类型枚举无参构造函数
     * </desc>
     * @param
     * @return
     * @author zhangs
     * @createDate 2017/09/22
     */
    AppUserProjectTypeEnum() {
    }

    /**
     * <desc>
     *      App用户项目类型枚举描述与类型构造函数
     * </desc>
     * @param description 描述
     * @param type 类型
     * @return
     * @author zhangs
     * @createDate 2017/09/22
     */
    AppUserProjectTypeEnum(String description, Integer type) {
        this.description = description;
        this.type = type;
    }

    /**
     * <desc>
     *      获取App用户项目类型枚举描述
     * </desc>
     * @param
     * @return String
     * @author zhangs
     * @createDate 2017/09/22
     */
    public String getDescription() {
        return description;
    }

    /**
     * <desc>
     *      获取App用户项目类型枚举类型
     * </desc>
     * @param
     * @return Integer
     * @author zhangs
     * @createDate 2017/09/22
     */
    public Integer getType() {
        return type;
    }

    /**
     * <desc>
     *      获取枚举的描述
     * </desc>
     * @param type 枚举类型
     * @return 枚举描述
     * @author zhangs
     * @createDate 2017/09/22
     */
    public static String getDescription(Integer type){
        AppUserProjectTypeEnum[] types = AppUserProjectTypeEnum.values();
        for(AppUserProjectTypeEnum limitCategory : types ){
            if(Objects.equals(limitCategory.getType(), type)){
                return limitCategory.getDescription();
            }
        }
        return null;
    }
}
